home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / HARDWARE.SWG / 0005_Determine CPU Speed.pas < prev    next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  55 lines

  1. {
  2. ·    Subject: How to determine mhz using TP6.0...
  3.  
  4. It seems to work pretty well, but on a 486/33DX it gave inacurate results...
  5. }
  6.  
  7. Program CpuSpeed;
  8. Uses
  9.   Crt;
  10. Var
  11.   Speed, DelayCalibrate : Word;
  12. Const
  13.   Offset = 9; { For TP 4.0, it should be 16 }
  14.  
  15.  
  16. Procedure WaitForFloppy;
  17. Var
  18.   tickTil     : LongInt;
  19.   TimerTicks  : LongInt Absolute $40 : $6C;
  20.   motorStatus : Byte Absolute $40 : $3F;
  21. begin
  22.   if MotorStatus and $F > 0 then
  23.   begin
  24.     WriteLn('Loading...');
  25.     TickTil := TimerTicks + 91;
  26.     {There are $17FE80 ticks in a day}
  27.     if TickTil > $17FE80 then
  28.       Dec(TickTil, $17FE80);
  29.     Repeat Until (MotorStatus and $F = 0) or (TimerTicks >= TickTil);
  30.   end;
  31. end;
  32.  
  33. begin
  34.   WaitForFloppy;
  35.   DelayCalibrate := MemW[Seg(CheckSnow): Ofs(CheckSnow)+Offset];
  36.   WriteLn('Delay calibration value is ', DelayCalibrate);
  37.   Speed := ((LongInt(1000) * DelayCalibrate) + 110970) div 438;
  38.   Write('Calculated speed: ', Speed div 100,'.');
  39.   WriteLn((speed div 10) MOD 10, speed MOD 10);
  40.   Write('CPU speed is probably ');
  41.   Case Speed OF
  42.     0..499     : WriteLn('4.77MHz or below');
  43.     500..699   : WriteLn('6MHz');
  44.     700..899   : WriteLn('8MHz');
  45.     900..1099  : WriteLn('10MHz');
  46.     1100..1399 : WriteLn('12MHz');
  47.     1400..1799 : WriteLn('16MHz');
  48.     1800..2199 : WriteLn('20MHz');
  49.     2200..2699 : WriteLn('25MHz');
  50.     2700..3599 : WriteLn('30MHz');
  51.     ELSE
  52.       WriteLn('30MHz or MORE!');
  53.   end;
  54. end.
  55.